//
//  BaseNetworkManager.h
//  BaseNetworkManager
//
//  Created by zyming on 2022/8/8.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

//宏定义成功block 回调成功后得到的信息
typedef void (^BaseHttpSuccess)(NSDictionary *responseObject);
//宏定义失败block 回调失败信息
typedef void (^BaseHttpFailure)(NSError *error);
@interface BaseNetworkManager : NSObject

+ (id)buildManager;
///GET请求
+ (void)GetWithUrlString:(NSString *)urlString parameters:(NSDictionary *_Nullable)parameters headers:(NSDictionary *_Nullable)headers success:(BaseHttpSuccess)success failure:(BaseHttpFailure)failure;
///POST请求
+ (void)PostWithUrlString:(NSString *)urlString parameters:(NSDictionary *_Nullable)parameters headers:(NSDictionary *_Nullable)headers success:(BaseHttpSuccess)success failure:(BaseHttpFailure)failure;
+ (void)PostBodyThirdWithUrl:(NSString *)urlString parameters:(id _Nullable)parameters headers:(NSDictionary *_Nullable)headers success:(BaseHttpSuccess)success failure:(BaseHttpFailure)failure;
///PATCH请求
+ (void)PatchWithUrlString:(NSString *)urlString parameters:(NSDictionary *_Nullable)parameters headers:(NSDictionary *_Nullable)headers success:(BaseHttpSuccess)success failure:(BaseHttpFailure)failure;
///PUT请求
+ (void)PutWithUrlString:(NSString *)urlString parameters:(NSDictionary *_Nullable)parameters headers:(NSDictionary *_Nullable)headers  success:(BaseHttpSuccess)success failure:(BaseHttpFailure)failure;
///PUT 从body传入数据
+ (void)PutBodyWithUrl:(NSString *)urlStr body:(NSDictionary *)bodyDict headers:(NSDictionary *_Nullable)headers success:(void(^)(NSDictionary *response))success failur:(void(^)(NSError *error))failur;
///DELETE请求
+ (void)DeleteWithUrlString:(NSString *)urlString parameters:(NSDictionary *_Nullable)parameters headers:(NSDictionary *_Nullable)headers success:(BaseHttpSuccess)success failure:(BaseHttpFailure)failure;

+ (void)DownloadURL:(NSString *) downloadURL  fieldName:(NSString *)fieldName progress:(void (^)(NSProgress *downloadProgress))progress destination:(void (^)(NSURL *targetPath))destination failure:(void(^)(NSError *error))faliureError;

+ (void)UploadFieldwith_URL:(NSString *)urlString andImage:(UIImage *)image andImageName:(NSString *)imageName success:(BaseHttpSuccess)success failure:(BaseHttpFailure)failure;


@end

NS_ASSUME_NONNULL_END
